﻿using System.Text;
using JNPF.Common.Enum;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Systems.Entitys.Permission;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;

namespace JNPF.Systems.Common;

/// <summary>
/// 测试接口.
/// </summary>
[ApiDescriptionSettings(Name = "Test", Order = 306)]
[Route("api/[controller]")]
public class TestService : IDynamicApiController, ITransient
{
    private readonly ISqlSugarRepository<UserEntity> _sqlSugarRepository;
    private readonly ITenant _db;

    public TestService(ISqlSugarRepository<UserEntity> sqlSugarRepository, ISqlSugarClient context)
    {
        _sqlSugarRepository = sqlSugarRepository;
        _db = context.AsTenant();
    }

    [HttpGet("")]
    [AllowAnonymous]
    public async Task<dynamic> test()
    {
        try
        {
            var xx = "{\"name\":\"ceshi\",\"id\":\"123456\"}".ToObject<dynamic>();
            var name = xx.name;
            return ExportFileType.bdd.ToString();
        }
        catch (Exception)
        {
            throw;
        }
    }
}
